package STUDENT.TRANDAODAIVI.ARRAY;
import java.util.Scanner;
class Arrangement{
	public static void descend(int[] array){
		System.out.print("Descending order: " );
		for (int i=0;i<array.length;i++){
			for(int j=i+1;j<array.length;j++){
				if(array[i]<array[j]){
					int x=array[i];
					array[i]=array[j];
					array[j]=x;
				}
			}
		}
		for (int i=0;i<array.length;i++){
			System.out.print(" "+array[i]);
		}
	}		
	
	public static void ascend(int[] array){
		System.out.print("Ascending order: " );
		for (int i=0;i<array.length;i++){
			for(int j=i+1;j<array.length;j++){
				if(array[i]>array[j]){
					int x=array[i];
					array[i]=array[j];
					array[j]=x;
				}
			}
		}
		for (int i=0;i<array.length;i++){
			System.out.print(" "+array[i]);
		}
	}
}
public class BT5 {
	public static void main(String[] args) {
	
		int[] array1={99,2,4,5,10,100,8,-22,44,3,60};
		Scanner sc=new Scanner(System.in);
		System.out.println("Mang da cho: array={99,2,4,5,10,100,8,-22,44,3,60}");
		System.out.print("Chon 1 sap xep giam dan - Chon 2 sap xep tang dan: ");
		int temp=sc.nextInt();
		sc=new Scanner(System.in);
		if(temp==1){
			Arrangement.descend(array1);
		} else if (temp==2) {
			Arrangement.ascend(array1);
		} else {System.out.println("De nghi nhap lai");}
		
		
		
}
}
